<template>
  <cfg-form
    :ref="ref"
    v-bind="attrs"
    :data="data.values"
    @change="change"
  ></cfg-form>
</template>

<script>
export default {
  name: "pg-form",
  components: {},
  inject: ["anc"],
  data() {
    return {
      ref: "createView",
      onlyRead: false,
    };
  },
  props: {
    data: {
      default: () => {
        return {};
      },
    },
    attrs: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  watch: {},
  computed: {},
  created() {},
  mounted() {
    this.$nextTick(() => {
      this.$set(this.anc.vms, this.ref, this);
    });
  },
  methods: {
    validate(fn) {
      return this.$refs[this.ref].$refs["form"].validate((valid) => {
        fn(valid);
      });
    },

    change(type, item) {
      if (type == "sf_maintainCycle") {
        this.anc.change(type, item);
      }
    },
  },
};
</script>
<style scoped></style>
